projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e486fb8
)
quartz: add evil casting to make sure time wraps correctly on 32bit machines
author
Michael Natterer
<mitch@gimp.org>
Thu, 23 Aug 2012 07:28:13 +0000
(09:28 +0200)
committer
Michael Natterer
<mitch@gimp.org>
Thu, 23 Aug 2012 07:31:12 +0000
(09:31 +0200)
get_time_from_ns_event(): apply patch from Michael Hutchinson which
makes sure the returned guint32 wraps correctly on 32 bit machines
when the uptime exceeds 2^32 ms.
gdk/quartz/gdkevents-quartz.c
patch
|
blob
|
history
diff --git
a/gdk/quartz/gdkevents-quartz.c
b/gdk/quartz/gdkevents-quartz.c
index 4921fcd510aad1809530ce55ad0c9ad28ad5a6f9..0c4c240793af550592e5e5a2b72f66f631911645 100644
(file)
--- a/
gdk/quartz/gdkevents-quartz.c
+++ b/
gdk/quartz/gdkevents-quartz.c
@@
-172,8
+172,11
@@
static guint32
get_time_from_ns_event (NSEvent *event)
{
double time = [event timestamp];
-
- return time * 1000.0;
+
+ /* cast via double->uint64 conversion to make sure that it is
+ * wrapped on 32-bit machines when it overflows
+ */
+ return (guint32) (guint64) (time * 1000.0);
}
static int